package it.crudity.web.controller;

import it.crudity.web.beanutils.PropertyMapConvert;
import it.crudity.web.json.JsonFilter;

import java.util.HashMap;
import java.util.Map;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/test/**")
public class MainController {

	//private static Logger logger = LoggerFactory.getLogger(MainController.class);


	@JsonIgnoreProperties( { "asd" })
	private static interface TestFilter {
	}
	
	public MainController() {
		System.out.println();
	}


	@RequestMapping("/test/json")
	@JsonFilter(mixin = TestFilter.class)
	public @ResponseBody
	TestBean test() {
		return new TestBean();
	}
	
	@RequestMapping("/test")
	@PropertyMapConvert({"a","b"})
	public @ResponseBody
	Object test2() {
	
		return new TestBean();
	}
	
	@RequestMapping("/test/2")
	public @ResponseBody
	Object test3() {
		Map<String, Object> map  = new HashMap<String, Object>();
		map.put("a", "test");
		return map;
	}





}
